-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<deque>
: Properly destroy (fancy) pointers to blocks in the internal map
#2775
<deque>
: Properly destroy (fancy) pointers to blocks in the internal map
#2775
Conversation
The map array is fully constructed just after allocation, so it should be fully destroyed before deallocation.
|
||
size_t fancy_counter{}; | ||
|
||
template <class T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is some pretty extensive work needed for a small test.
I am wondering whether it would make sense to reuse that machinery and test all containers for internal memory leaks?
Co-authored-by: Michael Schellenberger Costa <[email protected]>
Per @miscco 's comment.
Also place _Mysize() before _Newsize for consistency
for (; 0 < _Count; --_Count) { | ||
for (; _Count > 0; --_Count) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change requested: We generally try to avoid mixing unrelated cleanups into behavioral changes (as this increases the difficulty of reviewing and understanding source history). This isn't an ironclad rule - we're human and it's easier to fold changes into an existing PR, so a small amount of cleanup can be fine. In this case I think it's fine, but I wanted to mention it.
friend bool operator==(const counting_ptr& lhs, const counting_ptr& rhs) = default; | ||
|
||
friend auto operator<=>(const counting_ptr& lhs, const counting_ptr& rhs) = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change requested: In product code, we conventionally don't name parameters of defaulted functions. On the other hand, in test code we're somewhat less rigorous about conventions. On the third hand, operator=(const counting_ptr&)
didn't name its parameter, which is an argument for being locally consistent here. On the fourth and final hand, this isn't worth resetting testing. 😹
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
I've resolved a trivial adjacent-add merge conflict in |
Thanks for fixing this correctness bug! 🐞 🎉 😸 |
…l map (microsoft#2775) Co-authored-by: Michael Schellenberger Costa <[email protected]> Co-authored-by: Stephan T. Lavavej <[email protected]>
The internal map array is fully constructed, so it should also be fully destroyed before deallocation.
Fixes #2769.